package com.tuni.birthdaymoney.service.spring;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.tuni.birthdaymoney.persistence.entity.Department;
import com.tuni.birthdaymoney.persistence.repository.DepartmentRepository;
import com.tuni.birthdaymoney.service.DepartmentService;

@Service
@Transactional
public class SpringDepartmentService implements DepartmentService {

    @Autowired
    private DepartmentRepository departmentRepository;

    public Department findByName(String name) {
        return departmentRepository.findByName(name);
    }

    public Department findByID(Integer id) {
        return departmentRepository.findOne(id);
    }

    public Iterable<Department> findAll() {
        return departmentRepository.findAll();
    }

}
